package cn.shengchao.rule.engine;

import cn.shengchao.rule.base.ConditionGroup;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @program: examstarapi
 * @description: 规则对象
 * @author: Xiong weiqiang
 * @create: 2025-04-07 21:07
 */
@Data
@NoArgsConstructor
public class Rule implements IRule, Serializable {
    private Long id;
    private String name; // 规则名称
    private Integer priority; // 优先级
    private LocalDateTime startTime; // 生效开始时间
    private LocalDateTime endTime; // 生效结束时间
    private List<ConditionGroup> conditionGroups; // 条件组
    @Override
    public boolean equals(Object o) {
        return o.getClass().isAssignableFrom(IRule.class) &&this.id.equals(((IRule)o).getId());
    }
}